import request from '@/utils/request';

export async function siteStatistics() {
  const res = await request.get('/massage/workbench/siteStatistics');
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 统计图 获取充值

export async function getTopUpTotal(params) {
  const res = await request.get('/massage/workbench/getTopUpTotal', {
    params
  });
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
//   消费记录
export async function getConsumptionTotal(params) {
  const res = await request.get('/massage/workbench/getConsumptionTotal', {
    params
  });
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 用户记录
export async function workbench(params) {
  const res = await request.get('/massage/workbench/getUserRecordsTotal', {
    params
  });
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 最新订单

export async function getLatestOrder() {
  const res = await request.get('/massage/workbench/getLatestOrder');
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

//

export async function getSiteTOP() {
  const res = await request.get('/massage/workbench/getSiteTOP');
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

export async function siteLogin(data) {
  const res = await request.post('/massage/site/siteLogin', data);
  if (res.data.code === 200) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}
